<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateRolesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('roles', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('parent_id',false,true)->default(0)->comment('父级id');
            $table->string('name',100)->default('')->comment('角色名');
            $table->tinyInteger('status')->default(0)->comment('状态，-1删除,0禁用,1正常');
            $table->index('parent_id');
        });
        \Illuminate\Support\Facades\DB::statement("ALTER TABLE `roles` comment '管理员角色表'");
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('roles');
    }
}
